package com.telit.common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;


/**
 * <p>
 * 任务表
 * </p>
 *
 * @author yummy
 * @since 2021-07-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "AppTask", description = "任务表")
@NoArgsConstructor
@AllArgsConstructor
public class AppTask implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键ID")
    @TableId(type= IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "创建任务时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date createTime;

    @ApiModelProperty(value = "任务截止时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @NotEmpty
    private Date endTime;

    @ApiModelProperty(value = "任务完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date finishTime;

    @ApiModelProperty(value = "停留时间")
    private String waitTime;

//    @ApiModelProperty(value = "停留分钟")
//    @TableField(exist = false)
//    private String waitMinute;

    @ApiModelProperty(value = "类型 1-日常巡护任务 2-指定巡护任务 3-火情核实巡护任务 4-热点巡护任务 5-火情监测任务 6-火烧迹地巡护任务 "
            + "7-日常巡航任务 8-指定巡航任务 9-火情核实任务 10-热点巡航任务 11-火情监测任务 12-火烧迹地巡航任务 13-巡护任务 14-巡航任务")
    @NotBlank
    private String type;

    @ApiModelProperty(value = "状态")
    private String status;

    @ApiModelProperty(value = "标题")
    @NotBlank
    private String title;

    @ApiModelProperty(value = "内容")
    @NotBlank
    private String content;

    @ApiModelProperty(value = "下达任务人ID")
    private Long createPersonId;

    @ApiModelProperty(value = "航线ID")
    private Long cruiseLineId;

    @ApiModelProperty(value = "热点面积")
    private Double hotArea;

    @ApiModelProperty(value = "热点地址")
    private String hotAddress;

    // --------------------扩展属性 -----------------------------//

    @ApiModelProperty(value = "任务开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date startTime;

    @ApiModelProperty(value = "是否逾期 0未预期 1已预期")
    private Integer isDelay;

    @ApiModelProperty(value = "下达任务人Name")
    private String createPersonName;

    @ApiModelProperty(value = "执行人名称")
    private Object ExecutePersonName;

    @ApiModelProperty(value = "执行人id")
    private Long ExecutePersonId;

    @ApiModelProperty(value = "无人机名称")
    private Object uavCode;

    @ApiModelProperty(value = "待执行人数量")
    private Object pendingNumber;

    @ApiModelProperty(value = "执行中人数量")
    private Object executingNumber;

    @ApiModelProperty(value = "已执行人数量")
    private Object doneNumber;

    @ApiModelProperty(value = "逾期人数量")
    private Object delayNumber;

    @ApiModelProperty(value = "热点任务时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date hotTime;

}
